﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geodatabase;


namespace EAGL.Core
{
    /// <summary>
    /// Use this class to convert between esriFieldType enum and System.Type of the .net CTS
    /// </summary>
    public static class TypeConvertor
    {
        public static Type Convert(esriFieldType esriType)
        {
            int inType = (int)esriType;
            Type outType = null;
            switch (inType)
            {
                case 0:
                    outType = typeof(Int16);
                    break;

                case 1:
                    outType = typeof(Int32);
                    break;

                case 2:
                    outType = typeof(Single);
                    break;

                case 3:
                    outType = typeof(Double);
                    break;

                case 4:
                    outType = typeof(String);
                    break;

                case 5:
                    outType = typeof(DateTime);
                    break;

                case 6:
                    outType = typeof(Int32);
                    break;

                case 7:
                    outType = typeof(object);
                    break;

                case 8:
                    outType = typeof(object);
                    break;

                case 9:
                    outType = typeof(object);
                    break;

                case 10:
                    outType = typeof(object);
                    break;

                case 11:
                    outType = typeof(object);
                    break;

                case 12:
                    outType = typeof(object);
                    break;
            }
            return outType;
        }
    }
}
